package leveleditor;

import game.Game;
import game.GameViewArea;
import game.OptionsArea;
import gameconsts.EditorConsts;

import java.awt.BorderLayout;
import java.awt.Container;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JScrollPane;

public class LevelEditorUI
{
	private JFrame window;
	
	private void initUI(String title)
	{
		window = new JFrame(title);
		window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		window.setPreferredSize(new Dimension(EditorConsts.defaulWindowWidth, EditorConsts.defaultWindowHeight) );
		window.setLocation(EditorConsts.defaultWindowLocLeft, EditorConsts.defaultWindowLocTop);

		Container contentPane = window.getContentPane();

		GameViewArea gameViewArea = new GameViewArea();
		contentPane.add(new JScrollPane(gameViewArea), BorderLayout.CENTER);
		
		OptionsArea optionsArea = new OptionsArea();
		contentPane.add(optionsArea, BorderLayout.LINE_END);
		
		Game.interestedObserver(optionsArea);
		
		window.pack();
		window.setVisible(true);
		//window.setResizable(false);
		gameViewArea.startAnimation();
		
	}
	
	public static void main(String[] args)
	{
		LevelEditorUI ui = new LevelEditorUI();
		ui.initUI("Platformer game level editor: " + EditorConsts.defaulWindowWidth + " x " + EditorConsts.defaultWindowHeight);
	}
}
